]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
BluetoothStatus: hide the additional separator if no devices are shown
authorGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 20 Dec 2010 16:58:12 +0000 (17:58 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 20 Dec 2010 16:58:12 +0000 (17:58 +0100)
Sometimes devices are reported by BluetoothApplet, but are not shown,
so we should not count them to decide whether to show the device
separator.

js/ui/status/bluetooth.js

index ead3b1f88e2f08323b7b00816e55a1c10e0f8992..bde3f46cf611c76e05711949b2a3b1ad394228b9 100644 (file)
@@ -124,18 +124,20 @@ Indicator.prototype = {
         this._deviceItems = [];
 
         let devices = this._applet.get_devices();
-        if (devices.length == 0)
-            this._deviceSep.actor.hide();
-        else
-            this._deviceSep.actor.show();
+        let anydevice = false;
         for (let i = 0; i < devices.length; i++) {
             let d = devices[i];
             let item = this._createDeviceItem(d);
             if (item) {
                 this.menu.addMenuItem(item, this._deviceItemPosition + this._deviceItems.length);
                 this._deviceItems.push(item);
+                anydevice = true;
             }
         }
+        if (anydevice)
+            this._deviceSep.actor.show();
+        else
+            this._deviceSep.actor.hide();
     },
 
     _createDeviceItem: function(device) {